package com.googlecode.flealancemarket.service.commands.impl;

import com.googlecode.flealancemarket.metamodel.PrivateMessage;
import com.googlecode.flealancemarket.service.commands.DeleteMessage;
import com.googlecode.flealancemarket.service.facades.MessagesFacade;

public class DeleteMessageImpl implements DeleteMessage {

    private PrivateMessage message;
    private MessagesFacade facade;
    private Long id;

    public PrivateMessage getMessage() {
        return message;
    }

    public void setMessage(PrivateMessage message) {
        this.message = message;
    }

    public Long getId(){
        return id;
    }

    public void setId(Long id){
        this.id = id;
    }

    public MessagesFacade getFacade() {
        return facade;
    }

    public void setFacade(MessagesFacade facade) {
        this.facade = facade;
    }

    public void execute() {
        if(message!=null)
            facade.deleteMessage(message);
        else
            facade.deleteMessageById(id);
    }

    
}
